package np13.utils;

/**
 * Standard input, output. ThreadUnsafe.
 */
public class Console {

	private Console() {
	}

	/**
	 * Prints a string
	 * 
	 * @param message
	 *            string to print
	 */
	public static void print(String message) {
		if (enabled)
			System.out.print(Thread.currentThread().getName() + ": " + message);
	}

	/**
	 * Prints a String and then terminate the line.
	 * 
	 * @param message
	 *            string to print.
	 */
	public static void println(String message) {
		if (enabled)
			System.out.println(Thread.currentThread().getName() + ": "
					+ message);
	}

	/**
	 * Prints a string even if the console is disabled.
	 * 
	 * @param message
	 */
	public static void printlnWithForce(String message) {
		System.out.println(Thread.currentThread().getName() + ": " + message);
	}

	private static boolean enabled;

	/**
	 * Ebales or disables the console.
	 * 
	 * @param enable
	 */
	public static void setEnable(boolean enable) {
		enabled = enable;
	}
}
